package com.ty.day2;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/23 15:18
 */
public class StringBufferDemo {
    public static void main(String[] args) {
        StringBuffer sb=new StringBuffer();
        sb.append("G波");
        sb.insert(1,"G").insert(0,"大家好，我是");
        sb.append(",我喜欢冲击");
        int index = sb.indexOf("GG");
        System.out.println(index);
        sb.replace(sb.indexOf("大家好"),"大家好".length()+sb.indexOf("大家好"),"全民制作人好");
        System.out.println(sb);
        sb.delete(sb.indexOf("全民制作人好，"),sb.indexOf("全民制作人好，")+"全民制作人好，".length());
        System.out.println(sb);
        sb.reverse();
        System.out.println(sb);
        String s="垂帘画阁画帘垂";
        StringBuffer sb1=new StringBuffer(s);
        sb1.reverse();
        if (sb1.toString().equals(s)){
            System.out.println(sb1+",是回文,"+s);
        }
    }
}
